import time
import config
import devices
import gc
from gui.bootloader import BootWidgets
from machine import WDT, Pin
from gui.msgbox import IPAddressMsgbox

devices.mount_sdcard()

# 初始化配置项
config.load_conf("/config/conf.json")
devices.led_controller.reset()
devices.init_display()

boot = BootWidgets()
boot.start()

del boot

gc.collect()

from gui.weather_clock import WeatherClock

clock_widget = WeatherClock()

IPAddressMsgbox(Pin(13, Pin.IN, pull=Pin.PULL_DOWN))

wdt = WDT(timeout=1000 * 30)
while True:
    clock_widget.update()
    time.sleep(1)
    wdt.feed()
